import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    //第一题
    public static void main(String[] args) {
        binInsert(1024,19,2,6);
    }
    public static int binInsert(int n, int m, int j, int i) {
        int nlen = len(n);
        int mlen = len(m);
        int[] ret =new int[nlen + mlen];

        for(int k = 0;k < (nlen + mlen);k++){
            if( k> (j-1) && k < (i-1)){
                while(m != 0){
                    ret[k] = m%2;
                    m = m/2;
                    k++;
                }
            }
            ret[k] = n %2;
            n = n/2;
        }
        int fn = 0;
        int  s = 1;
        for(int k = 0;k < (nlen + mlen);k++){
            fn = fn+ ret[k] * s;
            s= s * 2;
        }
        return fn;



    }

    public static int len(int a ){
        int count = 0;
        while(a != 0){
            count++;
            a = a/2;
        }
        return count;
    }





//第二题 ：查找组成一个偶数最接近的两个素数
    /*public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int midl = a/2;
        int midr = a/2;
        while (midl != 0 && midr != a){

            while (!isprime(midl)){
                midl--;
            }
            while (!isprime(midr)){
                midr++;
            }
            if(midl + midr == a){
                System.out.println(midl);
                System.out.println(midr);
                return;
            }else {
                while (!isprime(midl)){
                    midl--;
                }
                while (!isprime(midr)){
                    midr++;
                }
            }
            if((-(midl - (a/2))) > (midr - a/2)){
                midr++;
            }else {
                midl--;
            }



        }


    }
    public static boolean isprime(int a) {
        for (int i = 2; i <= a / 2; i++) {
            if(a%i == 0){
                return false;
            }
        }
        return true;


    }*/

    ////
   /* public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int math = in.nextInt();
        int max = 0;
        int ret = 0;
        while(math != 0) {
            if(math % 2 == 1){
                max++;
            }else{
                max = 0;
            }
            math = math / 2;
            if(ret < math) {
                ret = max;
            }

        }
        System.out.println(ret);

    }*/
}